package jmine.tec.web.servlet.filter.resolver;

import java.io.Serializable;

import javax.servlet.http.HttpServletRequest;

import jmine.tec.utils.spring.InstanceResolver;
import jmine.tec.utils.spring.http.ThreadBoundInstaceResolver;

/**
 * Stores {@link HttpServletRequest} instances into {@link Thread} specific contexts.
 * 
 * @author takeshi
 */
public final class ThreadBoundRequestResolver implements InstanceResolver<HttpServletRequest>, Serializable {
    private static final long serialVersionUID = 5947321276410569174L;

    private final ThreadBoundInstaceResolver<HttpServletRequest> delegate =
            new ThreadBoundInstaceResolver<HttpServletRequest>();

    /**
     * @see br.com.maps.util.spring.InstanceResolver#clear()
     */
    public void clear() {
        this.delegate.clear();
    }

    /**
     * @see br.com.maps.util.spring.InstanceResolver#clearCurrentInstance()
     */
    public void clearCurrentInstance() {
        this.delegate.clearCurrentInstance();
    }

    /**
     * @return {@link HttpServletRequest}
     * @see br.com.maps.util.spring.InstanceResolver#getInstance()
     */
    public HttpServletRequest getInstance() {
        return this.delegate.getInstance();
    }

    /**
     * @param object {@link HttpServletRequest}
     * @see br.com.maps.util.spring.InstanceResolver#setInstance(java.lang.Object)
     */
    public void setInstance(final HttpServletRequest object) {
        this.delegate.setInstance(object);
    }

}
